package com.aaa.sbms.dao;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface RDMDao {
    //加载数据
    @Select("<script>select USERID,USERNAME,SEX,FLOOR,ROOM,CHECKINDATE,STATE from checkins " +
            " where STATE=2 " +
            "<if test=\"USERID!=null and USERID!=''\"> and USERID like concat('%',#{USERID},'%') </if>" +
            "<if test=\"USERNAME!=null and USERNAME!=''\"> and USERNAME like concat('%',#{USERNAME},'%')  </if>" +
            "</script>")
    List<Map> list(Map map);

    @Update("update checkins  set STATE=0 where USERID=#{USERID}")
    Integer updateIng(Integer USERID);

    @Update("update checkins  set STATE=1 where USERID=#{USERID}")
    Integer backIng(Integer USERID);

    @Update("update houses set BED=BED+1 where SEX=#{SEX} and FLOOR=#{FLOOR} and ROOM=#{ROOM}")
    int addBedCount(Map map);

}
